import VueRouter from "vue-router";
import Vue from "vue";
import Home from "@/pages/Home";
import Login from "@/pages/Login";
import News from "@/pages/Home/News";
import Music from "@/pages/Home/Music";
import Game from "@/pages/Home/Game";
import NotFound from "@/pages/NotFound";


Vue.use(VueRouter);


const router = new VueRouter({
    mode:"history",
    routes:[
        {
          path:"/",
          redirect:"/home"
        },
        {
            path:"/home",
            component:Home,
            //二级路由
            children:[
                //默认子路由
                {
                  path:"",
                  component:News,
                },
                {
                    path:"news",
                    component:News,
                    name:"News",
                },
                {
                    path:"music",
                    component:Music,
                    name:"Music",
                },
                {
                    path:"game",
                    component:Game,
                    name:"Game",
                }
            ]
        },
        {
            path:"/login",
            component:Login
        },
        {
            path:"/*",
            component:NotFound
        },
    ]
})

export default router